﻿using System;

namespace Behaviours.Helper
{
    public static class JsonHelper
    {
        public static string ToJson(object message)
        {
            return Newtonsoft.Json.JsonConvert.SerializeObject(message);
        }
        
        public static object FromJson(Type type, string json)
        {
            return Newtonsoft.Json.JsonConvert.DeserializeObject(json,type);
        }
        
        public static T FromJson<T>(string json)
        {
            return Newtonsoft.Json.JsonConvert.DeserializeObject<T>(json);
        }
    }
}